package com.hxzy.mapper.system;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hxzy.dto.system.DictDataDTO;
import com.hxzy.entity.system.SysDictData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysDictDataMapper extends BaseMapper<SysDictData> {

    // 查类型数据
    @Select(value = "select dict_type as dictType,dict_name as dictName from sys_dict_type")
    List<DictDataDTO> selectDictType();

    // 查回显样式数据
    @Select(value = "select case list_class when '' then 'default' else list_class end from sys_dict_data group by list_class")
    List<String> selectClass();


    // 根据id查
    @Select(value = "select id,dict_type as dictType,dict_sort as dictSort,dict_label as dictLabel,list_class as listClass, dict_value as dictValue,css_class as cssClass,remark,status from sys_dict_data where id=#{id}")
    SysDictData findDate(Long id);

    /**
     * 查询所有的status==0的数据
     * @return
     */
    List<SysDictData> findAll();

    List<SysDictData> selectByDictTypeName(String dictTypeName);
}